package com.dmpp.mes.controller;


import com.dmpp.mes.bean.ResponseData;
import com.dmpp.mes.parameterInfo.Category;
import com.dmpp.mes.parameterInfo.MaterialQuality;
import com.dmpp.mes.service.CategoryService;
import com.dmpp.mes.service.MaterialQualityService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@RequestMapping("MaterialQuality")
public class MaterialQualityController {
//原材料材质 半成品材质
    @Autowired
    private MaterialQualityService service;


    @RequestMapping(value = "/FindAll", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findAll(Integer page, Integer pageSize,MaterialQuality materialQuality) {
        PageHelper.startPage(page, pageSize);
        return service.findAll(materialQuality);
    }

    @RequestMapping(value = "/FindByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData findByCode(MaterialQuality materialQuality) {
        return service.findByCode(materialQuality);
    }

    @RequestMapping(value = "/Insert", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData insert(MaterialQuality materialQuality) {
        return service.insert(materialQuality);
    }

    @RequestMapping(value = "/UpdateByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData updateByCode(MaterialQuality materialQuality) {
        return service.updateByCode(materialQuality);
    }

    @RequestMapping(value = "/DeleteByCode", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData deleteByCode(MaterialQuality materialQuality) {
        return service.deleteByCode(materialQuality);
    }

    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    @ResponseBody
    public ResponseData delete(MaterialQuality materialQuality) {
        return service.delete(materialQuality);
    }

}
